package com.java2108.hetong.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.bw.zhanggm.common.AjaxResult;
import com.java2108.hetong.entity.HtCategorie;
import com.java2108.hetong.service.IHtCategorieService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 合同分类信息表 前端控制器
 * </p>
 *
 * @author zhanggm
 * @since 2024-02-23
 */
@RestController
@RequestMapping("hetong/categorie")
public class HtCategorieController {


    @Resource
    IHtCategorieService categorieService;

    @GetMapping("getListByPid")
    public AjaxResult getListByPid(@RequestParam(value = "parentId",required = false) Integer parentId) {
        LambdaQueryWrapper<HtCategorie> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        if (parentId == null) {
            lambdaQueryWrapper.isNull(HtCategorie::getParentId);
        } else {
            lambdaQueryWrapper.eq(HtCategorie::getParentId, parentId);
        }
        return AjaxResult.success(categorieService.list(lambdaQueryWrapper));
    }



}
